import React from 'react';
import { Switch, Route, Redirect } from 'react-router-dom';
import Jobs from './Jobs';
import Detail from './Detail';
import BetchAdd from '../BatchAdd';
import WebVulDetail from '../JobManage/WebTask/TaskDetail/WebTaskDetail/VulDetail';
import WebSSLDetail from '../JobManage/WebTask/TaskDetail/WebTaskDetail/SSLDetail';
import SecurityEventDetailP from '../JobManage/WebTask/TaskDetail/SecurityEventDetail/DetailP';
import ContentDetailC from '../JobManage/WebTask/TaskDetail/ContentDetail/DetailC';
import hostVulDetail from '../Task/TaskDetail/HostDetail/VulDetail';
export default function Weakness({ location }) {
	const search = location.search.replace(/targetSearch/, 'target_url');

	return (
		<Switch>
			<Route
				exact
				path="/asset-manage/manage/:assetType"
				component={Jobs}
				key={Date.now()}
			/>
			{location.pathname === '/jobs' && (
				<Redirect to={`/asset-manage/manage/web${search}`} />
			)}
			{/*
			<Route
				exact
				path="/asset-manage/manage/Detail/:assetType"
				component={Detail}
			/> */}
			<Route
				exact
				path="/asset-manage/manage/:assetType/Detail"
				component={Detail}
			/>
			<Route
				exact
				path="/asset-manage/manage/batch_add/:assetType"
				component={BetchAdd}
			/>
			<Route
				exact
				path="/asset-manage/manage/web/vul-detail"
				component={WebVulDetail}
			/>
			<Route
				exact
				path="/asset-manage/manage/web/ssl-detail"
				component={WebSSLDetail}
			/>
			<Route
				exact
				path="/asset-manage/manage/web/securityEvent-detail/:taskId/DetailP"
				component={SecurityEventDetailP}
			/>
			<Route
				exact
				path="/asset-manage/manage/web/content-detail/:taskId/DetailC"
				component={ContentDetailC}
			/>
			<Route
				exact
				path="/asset-manage/manage/host/host-task/detail"
				component={hostVulDetail}
			/>
		</Switch>
	);
}
